﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="GoogleAjax.ascx.vb" Inherits="UserCuntrols_GoogleAjax" %>
<style type="text/css">
    .gsc-tabsArea
    {
        display: none;
    }
    .gsc-resultsHeader
    {
        display: none;
    }
</style>

<script type="text/javascript">
    //<![CDATA[
    
    google.load('search', '1.0');

    var searchControl = null;
    cse = function(){
         // Create a search control
      searchControl = new google.search.SearchControl();

      searchControl.addSearcher(new google.search.WebSearch());
     
      var drawOptions = new google.search.DrawOptions();
      drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
      drawOptions.setInput(document.getElementById("txtGSearch"));
      // tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"),drawOptions);

      // execute an inital search
      //searchControl.execute("VW GTI");
      
    };
    
    GoogleSearch = function(){
        var q = document.getElementById('<%=_TextContril%>').value;
            if (q && q!= "") {
              searchControl.execute(q);
            }
    }
    function OnLoad() {
      new cse();
      var _ButtonControl = document.getElementById('<%=_ButtonControl %>')
      _ButtonControl.onclick += GoogleSearch;
    }
    google.setOnLoadCallback(OnLoad, true);

    
    
   
    //]]>
</script>

<input type="text" id="txtGSearch" style="display: none;" />
<div id="searchcontrol">Loading</div>
